class_name Character extends CharacterBody2D
@export var state_machine : StateMachine
@export_group("属性")
@export var move_speed : float = 100
@export var health : int = 5
@export_group("装备")
@export var hand: Node2D
@export var equipment: Equipment = null

func _enter_tree(): # 这里不能用ready
	if state_machine:
		state_machine.initialize(self)
func _physics_process(delta):
	if state_machine:
		state_machine.current_state.process(delta)

func equip(target: Equipment):
	target.reparent(hand, false)
	equipment = target
	equipment.anim_player.play("equiped")
	equipment.position = Vector2.ZERO

func drop():
	if equipment:
		equipment.reparent(get_parent())
		equipment = null
